package org.wsjy.service;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.wsjy.mapper.TContactMapper;
import org.wsjy.model.TContact;
import org.wsjy.util.DateUtil;

@Service
public class ContactService {

    @Autowired
    private TContactMapper contactMapper;
    
    public TContact getById(String stId){
        TContact contact = contactMapper.selectByPrimaryKey(stId);
        return contact;
    }

    public void insert(TContact contact) {
        contact.setStId(UUID.randomUUID().toString());
        contact.setDtCreateTime(DateUtil.getNow());
        contactMapper.insert(contact);
    }
    
    public void update(TContact contact){
        contact.setDtUpdateTime(DateUtil.getNow());
        contactMapper.updateByPrimaryKeyWithBLOBs(contact);
    }
}
